<?php
class MemberModel extends Model{
  // 自动验证设置
  protected $_validate	 =	 array(
  array('username','require','username 不能为空！'),
  array('password','require','password 不能为空！'),
  array('age','number','age 必须为数字'),
  array('email','require','email不能为空！'),
  array('email','email','email格式不正确'),
  array('question','require','question不能为空！'),
  array('answer','require','answer不能为空！'),
  array('email','require','email不能为空！'),
  array('username','','username已存在',0,'unique',self::MODEL_INSERT),
  array('email','','email已存在',0,'unique',self::MODEL_INSERT)
  );
  //自动填充设置
  public $_auto		=	array(
  array('password','pwdHash',self::MODEL_BOTH,'callback'),
  array('disabled', 0),
  array('create_time','get_client_time',self::MODEL_INSERT,'function'),
//   array('login_time','get_client_time',self::MODEL_BOTH,'function'),//user operate
  array('update_time','get_client_time',self::MODEL_BOTH,'function'),
  array("login_ip","get_client_ip",self::MODEL_BOTH,"function"),
  );
  protected function pwdHash() {
    if(isset($_POST['password'])) {
      return pwdHash($_POST['password']);
    }else{
      return false;
    }
  }
}

?>